package com.hksj.cbm.controller;

import com.hksj.cbm.dto.DeviceRoomTrusteeshipConfigDTO;
import com.hksj.cbm.dto.DeviceRoomTrusteeshipConfigQueryDTO;
import com.hksj.cbm.service.DeviceRoomTrusteeshipConfigService;
import com.hksj.cbm.vo.DeviceRoomTrusteeshipConfigVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @author fjt
 * @data 2024/8/17 15:37
 * @describe todo
 */
@Api(tags = "设备托管房间配置")
@RestController
@RequestMapping("/api/deviceRoomTrusteeshipConfig")
public class DeviceRoomTrusteeshipConfigController {

    @Autowired
    private DeviceRoomTrusteeshipConfigService deviceRoomTrusteeshipConfigService;


    @PostMapping("/queryConfig")
    @ApiOperation(value = "查询指定设备已设置和可设置的房间信息", notes = "查询指定设备已设置和可设置的房间信息",response = DeviceRoomTrusteeshipConfigVO.class)
    public Rest<List<DeviceRoomTrusteeshipConfigVO>>  queryConfig(@RequestBody @Valid DeviceRoomTrusteeshipConfigQueryDTO dto){
        return Rest.ok(deviceRoomTrusteeshipConfigService.queryConfig(dto));
    }



    @PostMapping("/batchReplace")
    @ApiOperation(value = "批量更新设备托管房间配置信息", notes = "批量更新设备托管房间配置信息(一次更新同一个设备在多个房间的配置信息)")
    public Rest batchReplace(@RequestBody @Valid DeviceRoomTrusteeshipConfigDTO dto){
        return Rest.ok(deviceRoomTrusteeshipConfigService.batchReplaceConfig(dto));
    }



}
